package kuaidi.servlet;

import kuaidi.dao.KInfoInsert;
import kuaidi.pojo.kBean;
import kuaidi.utils.umybatis;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;

@WebServlet("/user/*")

public class serachPacket extends BaseServlet {
    public void Serach(HttpServletRequest request , HttpServletResponse response) throws IOException {
        System.out.println("selext");
        String name = request.getParameter("name");
        String phone = request.getParameter("phone");
        SqlSession sqlSession = umybatis.getSqlSession();
        KInfoInsert mapper = sqlSession.getMapper(KInfoInsert.class);
        HashMap<String, Object> stringObjectHashMap = new HashMap<String, Object>();
        stringObjectHashMap.put("name",name);
        stringObjectHashMap.put("phone",phone);
        List<kBean> kuaidiInfo = mapper.getKuaidiInfo(stringObjectHashMap);
        super.writeValue(kuaidiInfo,response);
    }

}
